<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet [
<!ENTITY css SYSTEM "../phaidros.css">
]>
<xsl:stylesheet version="1.0" xmlns="http://www.w3.org/1999/xhtml" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="xml" encoding="utf-8" indent="yes" doctype-public="-//W3C//DTD XHTML 1.0 Transitional//EN" 
doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"/>

<xsl:include href="topbuttons.xsl"/>

<!-- main template -->
<xsl:template match="/">
<xsl:variable name="file" select="//response/@file"/>

<html>

<head>

<style type="text/css">
&css;
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<script type="text/javascript">
function redirect( action )
{
	var commandField = document.getElementById("Command");
	commandField.value = "";
	document.submission.action=action;
	document.submission.submit();
}
function notImplemented()
{
	alert("Sorry, this feature is not yet implemented");
}
function toggle( button, command )
{
	var groupId = button.id;
	var commandField = document.getElementById("Command");
	var groupField = document.getElementById("GroupId");
	groupField.value = groupId;
	commandField.value = command;
	document.submission.submit();
}
// dynamically resize central column
function resize()
{
	var divCol = document.getElementById("centralColumn");
	var divHeader = document.getElementById("header");
	var height = window.innerHeight - divHeader.offsetHeight;
	divCol.style.height=height+"px";
}
</script>
</head>
<body onload="resize()">
<div id="header" class="header">
<xsl:call-template name="writeTopButtons">
	<xsl:with-param name="writeSave">0</xsl:with-param>
	<xsl:with-param name="disabled">VersionsButton</xsl:with-param>
</xsl:call-template>
</div>

<div id="centralColumn" class="centralColumnBare">
<form name="submission" action="/Alpha/ViewVersions" method="post">
<p class="versionHeader">
<xsl:value-of select="//strings/string[@name='FilePrompt']/@value"/>
<xsl:value-of select="//response/@file"/></p><p class="description">
<xsl:value-of select="//strings/string[@name='DescriptionPrompt']/@value"/>
<span id="descSurrogate" class="information"><xsl:value-of select="//response/@description"/></span>
</p>

<!-- submission fields -->
<input type="hidden" name="Version1" id="Version1" value="1"/>
<input type="hidden" name="GroupId" id="GroupId" value="1"/>
<input type="hidden" name="File" id="File">
	<xsl:attribute name="value">
		<xsl:value-of select="$file"/>
	</xsl:attribute>
</input>
<input type="hidden" name="Command" id="Command" value=""/>
<xsl:for-each select="/response/groups/group">
	<ul>
	<xsl:call-template name="printGroup"/>
	</ul>
</xsl:for-each>
</form>
</div>
</body>
</html>
</xsl:template>

<xsl:template name="printGroup">
<li>
<xsl:choose>
    <xsl:when test="count(./group | ./version)>0">
        <input type="button" onclick="toggle(this,'Collapse')">
    	    <xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
    	     <xsl:attribute name="value">-</xsl:attribute>
    	</input>
   	</xsl:when>
	<xsl:when test="count(./group | ./version)=0">
	    <input type="button" onclick="toggle(this,'Expand')">
			<xsl:attribute name="id"><xsl:value-of select="@id"/></xsl:attribute>
			<xsl:attribute name="value">+</xsl:attribute>
		</input>
	</xsl:when>
</xsl:choose>
<xsl:text> </xsl:text><xsl:value-of select="@name"/>
</li>
<xsl:if test="count(./group | ./version)>0">
<ul>
<xsl:for-each select="./group">
	<xsl:call-template name="printGroup"/>
</xsl:for-each>
<xsl:for-each select="./version">
	<li>Version: <xsl:value-of select="@shortName"/><xsl:text> </xsl:text>(<xsl:value-of select="@longName"/>)
	<xsl:if test="@backup>0"><em> partial</em></xsl:if></li>
</xsl:for-each>
</ul></xsl:if>
</xsl:template>
</xsl:stylesheet>